home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / ksqueezedtextlabel.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  2.2 KB  |  85 lines

  1. /* This file is part of the KDE libraries
  2.    Copyright (C) 2000 Ronny Standtke <Ronny.Standtke@gmx.de>
  3.  
  4.    This library is free software; you can redistribute it and/or
  5.    modify it under the terms of the GNU Library General Public
  6.    License version 2 as published by the Free Software Foundation.
  7.  
  8.    This library is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  11.    Library General Public License for more details.
  12.  
  13.    You should have received a copy of the GNU Library General Public License
  14.    along with this library; see the file COPYING.LIB.  If not, write to
  15.    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  16.    Boston, MA 02110-1301, USA.
  17. */
  18.  
  19. #ifndef KSQUEEZEDTEXTLABEL_H
  20. #define KSQUEEZEDTEXTLABEL_H
  21.  
  22. #include <qlabel.h>
  23.  
  24. #include <kdelibs_export.h>
  25.  
  26. /**
  27.  * @short A replacement for QLabel that squeezes its text
  28.  *
  29.  * A label class that squeezes its text into the label
  30.  *
  31.  * If the text is too long to fit into the label it is divided into
  32.  * remaining left and right parts which are separated by three dots.
  33.  *
  34.  * Example:
  35.  * http://www.kde.org/documentation/index.html could be squeezed to
  36.  * http://www.kde...ion/index.html
  37.  *
  38.  * \image html ksqueezedtextlabel.png "KSqueezedTextLabel Widget"
  39.  *
  40.  * @author Ronny Standtke <Ronny.Standtke@gmx.de>
  41.  */
  42.  
  43. /*
  44.  * QLabel
  45.  */
  46. class KDEUI_EXPORT KSqueezedTextLabel : public QLabel {
  47.   Q_OBJECT
  48.  
  49. public:
  50.   /**
  51.    * Default constructor.
  52.    */
  53.   KSqueezedTextLabel( QWidget *parent, const char *name = 0 );
  54.   KSqueezedTextLabel( const QString &text, QWidget *parent, const char *name = 0 );
  55.  
  56.   virtual QSize minimumSizeHint() const;
  57.   virtual QSize sizeHint() const;
  58.   /**
  59.    * Overridden for internal reasons; the API remains unaffected.
  60.    */
  61.   virtual void setAlignment( int );
  62.  
  63. public slots:
  64.   void setText( const QString & );
  65.  
  66. protected:
  67.   /**
  68.    * used when widget is resized
  69.    */
  70.   void resizeEvent( QResizeEvent * );
  71.   /**
  72.    * does the dirty work
  73.    */
  74.   void squeezeTextToLabel();
  75.   QString fullText;
  76.  
  77. protected:
  78.   virtual void virtual_hook( int id, void* data );
  79. private:
  80.   class KSqueezedTextLabelPrivate;
  81.   KSqueezedTextLabelPrivate *d;
  82. };
  83.  
  84. #endif // KSQUEEZEDTEXTLABEL_H
  85.